﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="产品入库.aspx.cs" Inherits="syc.Fc.产品入库" %>
<html>
<head>
<style>
div.Panel7{display:inline;width:200px;text-align:center;}
</style>
</head>
<body>
    <script type="text/javascript" language="javascript" src="/common.js"></script>
    <form id="form1" runat="server">
    <div id="wintop" class="wintop">产品判定入库通知书 <asp:Label ID="Label1" runat="server" Text="录入"></asp:Label></div>
        <asp:Panel ID="Panel1" runat="server" CssClass="panel">
            <asp:Button ID="Button_Change" runat="server" Text="修改设置" CssClass="button" 
                UseSubmitBehavior="False" Visible="false" onclick="Button_Change_Click" />
            <asp:Button ID="Button_Save" runat="server" Text="保 存" CssClass="button" 
                UseSubmitBehavior="False" Enabled="false" onclick="Button_Save_Click" />
            <input type="button" value="导出通知书" class="button" onclick="Export();" style="font-weight:normal" />
            
            <input type="button" value="关 闭" class="button" onclick="parent.swin_close();" />
            <asp:DropDownList ID="ChanPinList" runat="server" Visible="false"></asp:DropDownList> 
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" ></asp:SqlDataSource>
        </asp:Panel>
        
        <asp:Panel ID="Panel2" runat="server" CssClass="panel">
            <span style="display:inline-block;width:210px;text-align:right;">
                生产单位：<asp:DropDownList ID="FenChang" runat="server" Width="120px" Enabled="false">
                    <asp:ListItem Value="1">一分厂</asp:ListItem>
                    <asp:ListItem Value="2">二分厂</asp:ListItem>
                    <asp:ListItem Value="5">五分厂</asp:ListItem>
                </asp:DropDownList>
            </span>
            
            <span style="display:inline-block;width:210px;text-align:right;">
                产品类别：<asp:DropDownList ID="ChanPin" runat="server" Width="120px" 
                AutoPostBack="True" onselectedindexchanged="ChanPin_SelectedIndexChanged">
                    <asp:ListItem Value="1">油管 Φ73.02×5.51</asp:ListItem>
                    <asp:ListItem Value="2">套管 Φ139.7×7.72</asp:ListItem>
                </asp:DropDownList> 
            </span>
            <span style="display:inline-block;width:226px;text-align:right;">
                日期：<asp:TextBox ID="RiQi" runat="server" CssClass="textbox" Width="120px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('RiQi').value, document.getElementById('RiQi'));" />
            </span>
            <br />
            <span style="display:inline-block;width:210px;text-align:right;">
                存储库区：<asp:TextBox ID="KuQu" runat="server" class="textbox" Width="120px"></asp:TextBox>
            </span>
            
            <span style="display:inline-block;width:210px;text-align:right;">
                入库序号：<asp:TextBox ID="XuHao" runat="server" class="textbox" Width="120px"></asp:TextBox>
            </span>
            <asp:Panel ID="Panel7" runat="server" Visible="false" CssClass="Panel7">
                <asp:RadioButton ID="RadioButton1" runat="server" Text="1号线" GroupName="scx" 
                    AutoPostBack="True" oncheckedchanged="RadioButton1_CheckedChanged" />
                <asp:RadioButton ID="RadioButton2" runat="server" Text="2号线" GroupName="scx" 
                    AutoPostBack="True" oncheckedchanged="RadioButton2_CheckedChanged" />
            </asp:Panel> 
            <br />
            <span style="display:inline-block;width:550px;padding-left:20px;">
            备　　注：<asp:TextBox ID="BeiZhu" runat="server" CssClass="textbox" Width="330px"></asp:TextBox> 限50字
            </span>
            <asp:Button ID="Button_Set" runat="server" Text="设 置" CssClass="wsbutton" 
                onclick="Button_Set_Click" UseSubmitBehavior="False"/>
        </asp:Panel>
    
        <asp:Panel ID="Panel3" runat="server" CssClass="panel" Visible="false">
        
            <span style="display:inline-block;width:210px;text-align:right;">
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                SelectCommand="SELECT [ID], [名称] FROM [原料供货单位]"></asp:SqlDataSource>
                原料供货商：<asp:DropDownList ID="YuanLiaoGongHuo" runat="server" Width="120px" 
                DataSourceID="SqlDataSource1" DataTextField="名称" DataValueField="ID">
                </asp:DropDownList>
            </span>
            <span style="display:inline-block;width:190px;text-align:right;">
                炉号：<asp:TextBox ID="LuHao" runat="server" class="textbox" Width="100px"></asp:TextBox>
            </span>
            
            <span style="display:inline-block;width:190px;text-align:right;">
                支数：<asp:TextBox ID="ZhiShu" runat="server" class="textbox" Width="100px"></asp:TextBox>
            </span>
            <br />
            <span style="display:inline-block;width:210px;text-align:right;">
                捆数编号：<asp:Label
                ID="KunHaoQZ" runat="server" Text="-"></asp:Label><asp:TextBox ID="KunHao" runat="server" class="textbox" Width="90px"></asp:TextBox>
            </span>
            
            <span style="display:inline-block;width:190px;text-align:right;">
                捆重量kg：<asp:TextBox ID="KunZhong" runat="server" class="textbox" Width="100px"></asp:TextBox>
            </span>
            
            <span style="display:inline-block;width:190px;text-align:right;">
                捆长度m：<asp:TextBox ID="KunChang" runat="server" class="textbox" Width="100px"></asp:TextBox>
            </span>
            
            &nbsp;<asp:Button ID="Button_Add" runat="server" Text="录入捆" CssClass="smallbutton" 
                onclick="Button_Add_Click" UseSubmitBehavior="False" />
            <asp:Button ID="Button_Del" runat="server" Text="删除捆" CssClass="smallbutton" 
                onclick="Button_Del_Click" UseSubmitBehavior="False"/>
        </asp:Panel>
        
        
        <asp:Panel ID="Panel4" runat="server" CssClass="panel2">
            <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
        </asp:Panel>





        <script>    putBillHead();</script>
<asp:Panel ID="Panel5" runat="server">
<style>
td.c0{height:60px;border:none;font-size:20pt;font-weight:bold;text-align:center;}
td.c1{width:78px;height:24px;border:1px solid #000000;}
td.c2{width:70px;border:1px solid #000000;}
td.c3{width:78px;border:1px solid #000000;}
td.c4{width:58px;border:1px solid #000000;}
td.c5{width:58px;border:1px solid #000000;}
td.c6{width:28px;border:1px solid #000000;}
td.c7{border:1px solid #000000;}
</style>
<table id=maintable border=0 cellpadding=0 cellspacing=0 style=text-align:center;border-collapse:collapse;font-size:10pt;>
	<tr>
		<td class=c0 colspan=12>产品判定入库通知书</td>
	</tr>
	<tr style="font-size:11pt;">
		<td height=28 colspan=3>生产单位：<%=this.FenChang.SelectedItem.Text +this.GetSCX()%></td>
		<td>　</td>
		<td colspan=3><%=this.RiQi.Text %></td>
		<td>　</td>
		<td colspan=4>编码：SYC/ZJ-JZ-19</td>
	</tr>
	<tr>
		<td class=c1>产品类别</td>
		<td class=c2><%=this.ChanPin.SelectedItem.Text.Split(" ".ToCharArray())[0] %></td>
		<td class=c3>钢级</td>
		<td class=c4>J55</td>
		<td class=c5>规格mm</td>
		<td class=c7 colspan=2 ><%=this.ChanPin.SelectedItem.Text.Split(" ".ToCharArray())[1] %></td>
		<td class=c2>库区</td>
		<td class=c3><%=this.KuQu.Text %></td>
		<td class=c4>入库序号</td>
		<td class=c7 colspan=2 ><%=this.XuHao.Text %></td>
	</tr>
	<tr>
		<td class=c1>技术条件</td>
		<td class=c7 colspan=2 >API Spec5CT</td>
		<td class=c4>总重量kg</td>
		<td class=c7 colspan=2 ><asp:Label ID="Label_ZZ" runat="server" Text="0"></asp:Label></td>
		<td class=c1>总长度m</td>
		<td class=c7 colspan=2 ><asp:Label ID="Label_ZC" runat="server" Text="0"></asp:Label></td>
		<td class=c5>总件数</td>
		<td class=c7 colspan=2 ><asp:Label ID="Label_ZZhi" runat="server" Text="0" Visible="false"></asp:Label><asp:Label ID="Label_ZJ" runat="server" Text="0"></asp:Label></td>
	</tr>
	<tr>
		<td class=c1>原料供货商</td>
		<td class=c2>炉号</td>
		<td class=c3>捆数编号</td>
		<td class=c4>捆重量kg</td>
		<td class=c5>捆长度m</td>
		<td class=c6>支数</td>
		<td class=c1>原料供货商</td>
		<td class=c2>炉号</td>
		<td class=c3>捆数编号</td>
		<td class=c4>捆重量kg</td>
		<td class=c5>捆长度m</td>
		<td class=c6>支数</td>
	</tr>
	
 
<%
    string[] item,item0;
    int i, j;
    string[] s = new string[12];

    string[] ta;
    for (i = 0; i < 30; i++)
    {

        
        if (this.ChanPinList.Items.Count > i)
        {
            item = this.ChanPinList.Items[i].Text.Split("'".ToCharArray());

            s[0] = this.YuanLiaoGongHuo.Items.FindByValue(item[1]).Text;
            s[1] = item[2];
            ta = item[0].Split("-".ToCharArray());
            s[2] = this.KunHaoQZ.Text;
            if (ta.Length > 1)
            {
                s[2] += ta[1];
            }
            else
            {
                s[2] += ta[0];
            }
            
            s[3] = item[3];
            s[4] = item[4];
            s[5] = item[5];

            if (i > 0)
            {
                item0 = this.ChanPinList.Items[i - 1].Text.Split("'".ToCharArray());
                if (item[1] == item0[1])
                {
                    s[0] = "";
                }
                if (item[2] == item0[2])
                {
                    s[1] = "";
                }
            }
        }

        if (this.ChanPinList.Items.Count > i+30)
        {
            item = this.ChanPinList.Items[i+30].Text.Split("'".ToCharArray());
            s[6] = this.YuanLiaoGongHuo.Items.FindByValue(item[1]).Text;
            s[7] = item[2];
            ta = item[0].Split("-".ToCharArray());
            s[8] = this.KunHaoQZ.Text;
            if (ta.Length > 1)
            {
                s[8] += ta[1];
            }
            else
            {
                s[8] += ta[0];
            }
            
            s[9] = item[3];
            s[10] = item[4];
            s[11] = item[5];
            item0 = this.ChanPinList.Items[i + 30-1].Text.Split("'".ToCharArray());
            if (item[1] == item0[1])
            {
                s[6] = "";
            }
            if (item[2] == item0[2])
            {
                s[7] = "";
            }
        }
        Response.Write("<tr>");
        for (j = 0; j < 12; j++)
        {
            Response.Write("\r<td class=c"+((j%6)+1)+">"+s[j]+"</td>");
            s[j] = "";
        }
        Response.Write("</tr>\r");
    }     
%>
<tr>
		<td class=c7 height=60>判断结论</td>
		<td class=c7 colspan=11 align="left" style="padding:3px;"><asp:Label ID="Label_BeiZhu" runat="server" Text=""></asp:Label><asp:Label ID="Label_JieLun" runat="server" Text=""></asp:Label></td>
	</tr>
	<tr>
		<td height=28>　</td>
		<td align=right>制表人：</td>
		<td colspan=6 align=left><asp:Label ID="Label_ZhiBiao" runat="server" Text=""></asp:Label></td>
		<td align=right>判定员：</td>
		<td colspan=3 align=left><asp:Label ID="Label_PanDing" runat="server" Text=""></asp:Label></td>
	</tr>
</table>
</asp:Panel>
<asp:Panel ID="Panel6" runat="server" HorizontalAlign="Right" Visible="false"><img src="/images/pdz.png" style="margin-top:-80px;margin-right:50px;" /></asp:Panel>

        <script>    putBillFoot();</script>

    </form>
    
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }

    document.body.onkeypress = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.className.toLowerCase() != "textbox") return;
        var i;
        if (e.keyCode == 13) {
            for (i = 0; i < textboxs.length; i++) {
                if (tag == textboxs[i]) {
                    if (i < textboxs.length - 1) {
                        textboxs[i + 1].focus();
                        return false;
                    }
                }
            }
        }
    };

    var mt = document.getElementById("maintable");
    mt.onclick = function(e) {
        if (!e) e = window.event;
        var col = e.srcElement;
        if (!col) col = e.target;
        if (col.tagName.toUpperCase() != "TD") return;
        var row = col.parentNode;
        if (row.rowIndex < 5) return;
        var x = 0;
        if (col.cellIndex > 5) x = 6;

        if (row.cells[x + 2].innerHTML != "") {

            var ta=row.cells[x + 2].innerHTML.split("-");
            if(ta.length==1)
            {
                document.getElementById("KunHao").value=ta[0];
            }
            else
            {
                document.getElementById("KunHao").value=ta[1];
            }
            document.getElementById("KunZhong").value = row.cells[x + 3].innerHTML;
            document.getElementById("KunChang").value = row.cells[x + 4].innerHTML;
            document.getElementById("ZhiShu").value = row.cells[x + 5].innerHTML;

            while(true)
            {
                if(row.cells[x].innerHTML!="")
                {
                    document.getElementById("LuHao").value = row.cells[x + 1].innerHTML;
                    var op=document.getElementById("YuanLiaoGongHuo").options;
                    for(var i=0;i<op.length;i++)
                    {
                        if(op[i].text==row.cells[x].innerHTML)
                        {
                            document.getElementById("YuanLiaoGongHuo").selectedIndex=i;
                            break;
                        }
                    }
                    break;
                }
                else
                {
                    row=row.previousSibling;
                    if(row.rowIndex<5)
                    {
                        if(x==0)
                        {
                            break;
                        }
                        else    
                        {
                            row=row.parentNode.rows[34];
                            x=0;
                        }
                            
                    }
                }
                
            }
        }
    };
    document.body.onload = function() {
        var KunHao = document.getElementById("KunHao");
        var LuHao = document.getElementById("LuHao");
        var KunZhong = document.getElementById("KunZhong");
        if (LuHao && !LuHao.value) {
            LuHao.focus();
        }
        else if (KunHao && !KunHao.value) {
            KunHao.focus();
        }
        else if (KunZhong) {
            KunZhong.focus();
        }
    }
    function Export() {
        form2.content.value = "<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head><style>@page Section1{size:23.0cm 16.0cm;margin:1.5cm 0.5cm 0.5cm 0.5cm;size:21.0cm 29.7cm;text-align:center;}"
            + "div.Section1{page:Section1;}</style><div class=Section1>"
            + document.getElementById("Panel5").innerHTML
            + "</div>";
        form2.submit();
    }
</script>


<form id="form2" method="post" action="/PageExport.ashx">
<input type="hidden" name="filename" value="产品判定入库通知书.doc" />
<input type="hidden" name="content" value="" />
</form>

</body>
</html>